<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增漫画爬虫')"/>
    <!--select 下拉框-->
    <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-climb-add">

        <div class="form-group">
            <label class="col-sm-3 control-label">漫画</label>
            <div class="col-sm-8">
                <select class="form-control" name="nameId">

                </select>
            </div>
        </div>

        <!--<div class="form-group">
            <label class="col-sm-3 control-label">漫画：</label>
            <div class="col-sm-8">
                <input name="nameId" class="form-control" type="text">
            </div>
        </div>-->

        <div class="form-group">
            <label class="col-sm-3 control-label">内链外链：</label>
            <div class="col-sm-8">
                <select name="network" class="form-control m-b">
                    <option value=""></option>
                    <option  value="1">内链</option>
                    <option  value="2">外链</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">内链外链：</label>
            <div class="col-sm-8">
                <select name="webType" class="form-control m-b" th:with="type=${@all.toAll()}">
                    <option value="">所有</option>
                    <option th:each="map : ${type}" th:text="${map.key}" th:value="${map.value}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">网页地址：</label>
            <div class="col-sm-8">
                <input name="webUrl" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea name="remark" class="form-control"></textarea>
            </div>
        </div>
        <!-- <div class="form-group">
             <label class="col-sm-3 control-label">删除标志：</label>
             <div class="col-sm-8">
                 <input name="delFlag" class="form-control" type="text">
             </div>
         </div>-->
    </form>
</div>
<th:block th:include="include :: footer"/>
<!--select 下拉框-->
<th:block th:include="include :: select2-js"/>

<script th:inline="javascript">
    var prefix = ctx + "manhua/climb";
    let select_nameId = $("select[name='nameId']");

    $(function () {
        /*r添加 漫画名称选着*/
        select_nameId.html(nameId([[${MhNameDataAll}]]));

    });

    /*添加 select 选着框漫画的 id 与名称*/
    let nameId = (map) => {

        if (map != null) {

            let html = '<option value="">--请选择漫画--</option>';

            for (let key in map) {
                html += `<option value="${key}">${map[key]}</option>`;
            }
            return html;
        }
    }

    $("#form-climb-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-climb-add').serialize());
        }
    }
</script>
</body>
</html>
